public abstract class Builder {
    public static void main(String[] args) {
        Director director = new Director();
        director.setBuilder(new BuilderA());
        director.show();
        director.setBuilder(new BuilderB());
        director.show();
    }

    public abstract void showA();

    public abstract void showB();

    public abstract void showC();
}

class BuilderA extends Builder {
    public void showA() {
        System.out.println("BuilderA.showA()");
    }

    public void showB() {
        System.out.println("BuilderA.showB()");
    }

    public void showC() {
        System.out.println("BuilderA.showC()");
    }
}

class BuilderB extends Builder {
    public void showA() {
        System.out.println("BuilderB.showA()");
    }

    public void showB() {
        System.out.println("BuilderB.showB()");
    }

    public void showC() {
        System.out.println("BuilderB.showC()");
    }
}

class Director {
    Builder builder = null;

    public void setBuilder(Builder b) {
        this.builder = b;
    }

    public void show() {
        this.builder.showA();
        this.builder.showB();
        this.builder.showC();
    }
}